package hy.controller;

import hy.bean.Emp;
import hy.dao.EmpMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class EmpCtrl {

    @Autowired
    EmpMapper dao;

    @RequestMapping("/showEmps")
    public String showEmp(Model m){
        //访问dao得到全部员工数据，放在域中，跳转到emps.html中
        List<Emp> list=dao.selectAllEmp();
        m.addAttribute("emps",list);
        return "emps";
    }

}
